﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace System.Windows.Media
{
    /// <summary>
    /// Implements a simple descriptor which describes a complete rendering transform origin, including position, scale, rotation, skewing
    /// and opacity.
    /// </summary>
    public class TransitionState
    {
        /// <summary>
        /// Initializes a <see cref="TransitionState"/> instance.
        /// </summary>
        public TransitionState()
        {

        }

        /// <summary>
        /// Initializes a <see cref="TransitionState"/> instance.
        /// </summary>
        public TransitionState(double x, double y, double scaleX, double scaleY, double angle, double skewX, double skewY, double opacity)
        {
            this.X = x;
            this.Y = y;
            this.ScaleX = scaleX;
            this.ScaleY = scaleY;
            this.Angle = angle;
            this.SkewX = skewX;
            this.SkewY = skewY;
            this.Opacity = opacity;
        }

        /// <summary>
        /// Gets/Sets a double value indicating the Skew Angle X for the <see cref="TransitionState"/>.
        /// </summary>
        public double SkewX { get; set; }

        /// <summary>
        /// Gets/Sets a double value indicating the Skew Angle Y for the <see cref="TransitionState"/>.
        /// </summary>
        public double SkewY { get; set; }

        /// <summary>
        /// Gets/Sets a double value indicating the X scale factor for the <see cref="TransitionState"/>.
        /// </summary>
        public double ScaleX { get; set; }

        /// <summary>
        /// Gets/Sets a double value indicating the Y scale factor for the <see cref="TransitionState"/>.
        /// </summary>
        public double ScaleY { get; set; }

        /// <summary>
        /// Gets/Sets a double value indicating the rotation angle for the <see cref="TransitionState"/>.
        /// </summary>
        public double Angle { get; set; }

        /// <summary>
        /// Gets/Sets a double value indicating the X position for the <see cref="TransitionState"/>.
        /// </summary>
        public double X { get; set; }

        /// <summary>
        /// Gets/Sets a double value indicating the Y scale factor for the <see cref="TransitionState"/>.
        /// </summary>
        public double Y { get; set; }

        /// <summary>
        /// Gets/Sets a double value indicating the opacity factor for the <see cref="TransitionState"/>.
        /// </summary>
        public double Opacity { get; set; }

        /// <summary>
        /// Initializes a <see cref="TransitionState"/> instance as a rotation and opacity state.
        /// </summary>
        /// <param name="angle">The angle of rotation</param>
        /// <param name="opacity">The opacity</param>
        /// <returns>A <see cref="TransitionState"/> object</returns>
        public static TransitionState AsRotation(double angle, double opacity)
        {
            return new TransitionState(0, 0, 1, 1, angle, 0, 0, opacity);
        }

        /// <summary>
        /// Initializes a <see cref="TransitionState"/> instance as a scale and opacity state.
        /// </summary>
        /// <param name="scaleX">The horizontal scale</param>
        /// <param name="scaleY">The vertical scale</param>
        /// <param name="opacity">The opacity</param>
        /// <returns>A <see cref="TransitionState"/> object</returns>
        public static TransitionState AsScale(double scaleX, double scaleY, double opacity)
        {
            return new TransitionState(0, 0, scaleX, scaleY, 0, 0, 0, opacity);
        }

        /// <summary>
        /// Initializes a <see cref="TransitionState"/> instance as a translation and opacity state.
        /// </summary>
        /// <param name="x">The x position</param>
        /// <param name="y">The y position</param>
        /// <param name="opacity">The opacity</param>
        /// <returns>A <see cref="TransitionState"/> object</returns>
        public static TransitionState AsTranslate(double x, double y, double opacity)
        {
            return new TransitionState(x, y, 1, 1, 0, 0, 0, opacity);
        }

        /// <summary>
        /// Initializes a <see cref="TransitionState"/> instance as a translation and opacity state.
        /// </summary>
        /// <param name="skewX">The x skew angle</param>
        /// <param name="skewY">The y skew angle</param>
        /// <param name="opacity">The opacity</param>
        /// <returns>A <see cref="TransitionState"/> object</returns>
        public static TransitionState AsSkew(double skewX, double skewY, double opacity)
        {
            return new TransitionState(0, 0, 1, 1, 0, skewX, skewY, opacity);
        }

        /// <summary>
        /// Initializes a <see cref="TransitionState"/> instance as opacity state only.
        /// </summary>
        /// <param name="opacity">The opacity</param>
        /// <returns>A <see cref="TransitionState"/> object</returns>
        public static TransitionState AsOpacity(double opacity)
        {
            return new TransitionState(0, 0, 1, 1, 0, 0, 0, opacity);
        }
    }
}
